home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _CATCODE.PRG < prev    next >
Text File  |  1993-05-04  |  2KB  |  59 lines

  1. PROCEDURE _CatCode
  2. PARAMETERS pc_file, pn_code
  3. *---------------------------------------------------------------------
  4. * NAME
  5. *   _CatCode - get the CODE for a specified file in the catalog
  6. *
  7. * DESCRIPTION
  8. *   _CatCode will put the CODE field value into <pn_code> for the catalog
  9. *   FILE_NAME specified by pc_file.  If pc_file was not located
  10. *   in the catalog, _CatCode return a blank value for <pn_code>.
  11. *
  12. *   _CatCode will keep the record pointer in the Catalog at
  13. *   the FILE_NAME record.
  14. *
  15. * SYNOPSIS
  16. *   DO _CatCode WITH <pc_file>, <pn_code>
  17. *
  18. * PARAMETERS
  19. *   pc_file = file name to search with
  20. *   pn_code = return code for file, 0 if no match.
  21. *
  22. * EXAMPLE
  23. *   *-- Find the CODE for file GOODS.SCR
  24. *   ll_CatOpen
  25. *   DO _CatOpen WITH ll_CatOpen
  26. *   IF ll_CatOpen
  27. *     SELECT FXCatalog
  28. *     ln_code = 0
  29. *     DO _CatCode WITH "GOODS.SCR", ln_code
  30. *     DO _CatClose
  31. *   ENDIF
  32. *
  33. * LIMITATIONS
  34. *   pc_file is fileroot() + '.' + filetype() format
  35. *
  36. * DEPENDENCIES
  37. *   The catalog must be in the current work area
  38. *
  39. * VARIABLES
  40. *   lc_file   = Uppercase representation of <pc_file> value
  41. *
  42. *---------------------------------------------------------------------
  43.  
  44.   PRIVATE lc_file
  45.  
  46.   pn_code = -1                          && Assume the worst case for result
  47.  
  48.   *-- Look for the file selected in the open catalog file
  49.   lc_file = UPPER( pc_file )            && Force the search to upper case
  50.   LOCATE FOR UPPER( file_name ) = lc_file
  51.  
  52.   IF FOUND()                            && If the file was found
  53.     pn_code = FXCatalog->code           && Pull in the code for the result
  54.   ENDIF
  55.  
  56. RETURN
  57. *-- EOP:  _CatCode WITH pc_file, pn_code
  58.  
  59.